/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.figures;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.swt.graphics.RGB;

import com.cea.papyrus.core.PapyrusPlugin;

// TODO: Auto-generated Javadoc
/**
 * This is a basic figure to represent a rectangle.
 * 
 * @author Patrick Tessier
 * @since 14 sept. 06
 */
public class ElementFigure extends NodeFigure {

	/**
	 * The content pane.
	 */
	private Figure contentPane;
	
	
	/**
	 * this is the constructor to create a elementFigure.
	 */
	public ElementFigure()
	{
		ToolbarLayout layout = new ToolbarLayout();
		layout.setStretchMinorAxis(true);
		this.setLayoutManager(layout);

		this.setOpaque(true); // non-transparent figure
		//setBorder( new LineBorder(ColorConstants.black));
		this.setBorder( new LineBorder(PapyrusPlugin.colorManager.get(new RGB(255,255,255))));
		//setBackgroundColor(ColorConstants.yellow);
		this.setBackgroundColor(PapyrusPlugin.colorManager.get(new RGB(0,0,0)));

		// The area accepting inner figures.
		this.createContentPane();
	}
	
	/**
	 * return a container to add some graphical element as label for instance.
	 * 
	 * @return the container to add some new graphical elements
	 */
	public IFigure getContentPane()
	{
		return this.contentPane;	
	}

	/**
	 * this method is uesed to create the contentfigure.
	 */
	protected void createContentPane()
	{
		this.contentPane = new Figure();
		ToolbarLayout layout = new ToolbarLayout();
		layout.setVertical(true);
		this.contentPane.setLayoutManager(layout);
		this.add(this.contentPane);		
	}
}
